<?php
namespace app\api\controller\v1;
use app\api\controller\Common;

class Goods extends Common{
	var $modelDb;
	public function _initialize(){
		parent::_initialize();
		$this->modelDb = model("Goods");
	}
	public function index(){
		$data = $this->modelDb->list_datas($this->postData);
    	if(!empty($data)){
    		return $this->app_success($data);
    	}
    	else{
    		return $this->app_success([],'列表为空');
    	}
	}
	public function list_show(){
		$where['id'] = ['neq', 3];
		$where['pid'] = ['neq', 3];
		$list = model("GoodsCate")->list_data($where, 0, 0, 'id, title, thumb');
		// $lists = [];
		// foreach ($list as $v) {
		// 	$v['goodslist'] = $this->modelDb->list_data(['catid'=>$v['id']], 10, 0, 'id,title,thumb,price,linkurl');
		// 	$lists[] = $v;
		// }
    	if(!empty($list)){
    		return $this->app_success($list);
    	}
    	else{
    		return $this->app_success([],'列表为空');
    	}
	}
}